package com.biodiv.community.consumer;

import com.biodiv.community.enums.TopicEnum;
import com.biodiv.community.event.OrderEvent;
import com.biodiv.community.manager.mq.RedisListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

import static com.biodiv.community.enums.TopicEnum.TOPIC_TWO;

/**
 * @author tianquan
 */
@Slf4j
@Component
public class OrderListener extends RedisListener<OrderEvent> {

    @Override
    @EventListener
    protected void handleMessage(OrderEvent event) {
        log.info("Thread name: {}", Thread.currentThread().getName());
        log.info("Handling message in QueueOne: {}", event);
    }

    @Override
    public TopicEnum getTopic() {
        return TOPIC_TWO;
    }

}